const { resolve } = require('path')
const { dir, entry } = require('./u.config')
import vue from '@vitejs/plugin-vue'

module.exports = {
  plugins: [vue()],
  // root: resolve(__dirname, dir),
  server: {
    open: `/${dir}/${entry}.html`,
    proxy: {
      '/baidu': {
        target: 'https://www.baidu.com',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/baidu/, ''),
      },
    },
  },
  build: {
    rollupOptions: {
      input: {
        main: resolve(__dirname, `${dir}/${entry}.html`),
      },
    },
  },
}
